<template>
	<view class="all">
		<!-- 头部 -->
		<fundShopHead class="all-head"></fundShopHead>
		<!-- 内容 -->
		<view class="add">
			<view class="content" v-for="(item, index) in arr" :key="index" :class="[grayBackground(index)]">
				<image src="../../static/img/star.png" mode=""></image>
				<view class="content-middle">
					<view class="content-middleOne">{{item.name}}</view>
					<view class="content-middleTwo">{{item.serial}}</view>
				</view>
				<view class="content-right">
					<text>{{item.net}}</text>
					<text>{{item.dayup}}</text>
				</view>
			</view>
		</view>

		<!-- 尾部 -->
		<view class="foot">
			<fundShopFoot></fundShopFoot>
		</view>
	</view>
</template>

<script>
	// 引入接口
	import {
		conten
	} from "../../API/foodShop.js"
	// 引入头部组件
	import fundShopHead from '../../components/fundShopHead.vue';
	// 引入尾部
	import fundShopFoot from '../../components/fundShopFoot/fundShopFoot.vue'
	export default {
		// 注册组件
		components: {
			fundShopHead: fundShopHead,
			fundShopFoot: fundShopFoot
		},
		data() {
			return {
				arr: []
			}
		},
		methods: {
			onShow() {
				this.callContent()
			},
			callContent() {
				conten()
					.then((res) => {
						console.log(res);
						this.arr = res.data.data

					})
					.catch((error) => {
						console.error(error);
					});
			}
		},
		computed: {
			grayBackground() {
				return index => index % 2 === 1 ? 'gray-background' : '';
			},
		},
	}
</script>

<style scoped>
	.all {
		background-color: #f7f7f7;
		position: relative;
	}

	.all-head {
		width: 100vw;
		position: fixed;
		top: 0rpx;
		z-index: 999;
	}

	.title {
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0rpx 20rpx;
		font-size: 35rpx;
		font-weight: 600;
	}

	.title image {
		width: 50rpx;
		height: 50rpx;
	}

	.title text {
		margin-left: 20rpx;
	}

	.foot {
		width: 100%;
		position: absolute;
		bottom: 0rpx;
	}

	/* 内容 */
	.content {
		height: 200rpx;
		background-color: white;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		padding-left: 20rpx;
		position: relative;
	}


	.content image {
		width: 50rpx;
		height: 50rpx;
	}

	.content-right {
		display: flex;
		justify-content: space-around;
		width: 40%;
		position: absolute;
		right: 20rpx;
	}

	.content-middle {
		height: 140rpx;
		display: flex;
		justify-content: space-around;
		flex-direction: column;
		margin-left: 20rpx;
	}

	.content-middleOne {
		font-size: 30rpx;
	}

	.content-middleTwo {
		color: #747474;
	}

	.content-right text:nth-child(2) {
		color: red;
	}

	.gray-background {
		background-color: #f5f5f5;
		/* 或者你想要的灰色背景色 */
	}
</style>